<?php
session_start(); include_once 'data/usercheck.php'; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<title>Food Online</title>
	<link rel="stylesheet" href="style.css" type="text/css" charset="utf-8" />
    
    
  
    
    
</head>
<body>





  <div id="wrapper">
    <div id="logo">
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <table width="200" border="0" align="center">
    <tr>
      <td height="30"><FONT size="+6">
        <div align="center">STMS</div></td>
    </tr>
    <tr>
      <td><div align="center">STUDENT MANAGEMENT SYSTEM</div></td>
    </tr>
</table>
  <p>&nbsp;</p>
</div>
    <div id="nav">
      <div id="nav-left">
        <ul>
          <li><a href="HometoAdmin.php">Home</a></li>
          <li class="orange">
            <div align="left"><a href="http://localhost/stms/pages/data/logout.php">Logout-<?php include_once 'data/databaseconnection.php';session_start();echo $_SESSION['username'];?></a></div>
          </li>
        </ul>
      </div>
      <div id="nav-right">
        <ul>
         
           <li><a href="Aboutus.php">About us</a></li>
          <li><a href="viewhome.php">Student</a></li>
          <li><a href="Adminhome.php">Admin</a></li>
          <li><a href="http://studentmanagements.blogspot.com/">Contact</a></li>
        </ul>
      </div>
    </div>
    <style type="text/css">
			div.scrollbar {
				height: 300px;
				overflow: auto;
				border: solid 1px ;
				padding: 5px;
				width:250px;
				face: red;
				
				
			}
		</style>
       
    <div align="right"></div>
    <div id="body">
      <div align="right">
        <div align="left">
          <div align="left">
            <table width="747" border="0">
              <tr>
                <td width="104" height="23"  ><span class="clear"><font size="+1" ><a href="showadmin.php">Basicdetails</a></font></span></td>
                <td width="88"><span class="clear"><font size="+1"><a href="aladmin.php">A/Ldetails</a></font></span></td>
                <td width="110"><span class="clear"><font size="+1"><a href="compadmin.php">Combination</a></font></span></td>
                <td width="79"><span class="clear"><font size="+1"><a href="courseadmin.php">Course</a></font></span></td>
                <td width="54"><span class="clear"><font size="+1"><a href="Resultadmin.php">Result</a></font></span></td>
                <td width="100"><font size="+1"><a href="changepass.php"><span class="clear"><font size="+1"></font></span></a><span class="clear"><font size="+1"><a href="attendadmin.php">Attendance</a></font></span></font></td>
                <td width="176"><div align="right"><font size="+1"><a href="changepass.php">changepassword</a></font></div></td>
              </tr>
            </table>
          </div>
        </div>
      </div>
      <div class="clear">
      <p>&nbsp;</p>
	  <p><?php
        if (isset($_GET['err'])) {
            $err = $_GET['err'];
            echo '<span  style="color:  #F4C389"  >'.$err.'</span>';
			}
	
        if (isset($_GET['err1'])) {
            $err1 = $_GET['err1'];
			
			$sql=mysql_query("select * from basicdetails where Regno='$err1'");
			while($row=mysql_fetch_array($sql))
			{
				$reg=$row['Regno'];
				$tit=$row['Title'];
				
				
				$fna=$row['Firstname'];
				$lna=$row['Lastname'];
				$nic=$row['NICno'];
				$gen=$row['Gender'];
				$civ=$row['Civilstatus'];
				$dob=$row['DOB'];
				$nat=$row['Nationality'];
				$rel=$row['Religion'];
				$padd=$row['Permanentaddress'];
				$tmp=$row['Temporaryaddress'];
				$fac=$row['Faculty'];
				$cou=$row['CourseOfStudy'];
				$aca=$row['AcademicYear'];
				$dis=$row['District'];
				
			}
        }
        ?>
		</P>
	  <p><font size="-1"><marquee direction="left">The Regno is must for the changes</marquee></font></P>
		 <form id="insert" method="post" action="data/insertdetails.php">
	  <table width="747" border="0">
	    <tr>
	      <td width="453" rowspan="2"><table width="453" border="0">
	        <tr>
	          <td><font  size="-1">Regno</font></td>
	          <td><input type="text"  name="Regno" id="Regno"  value="<?php echo $reg; ?>" placeholder="2009/SP/004"  pattern="[0-9]{4}/[A-Z]{2}/[0-9]{3}"  /></td>
	          <td><font  size="-1">Nationality</font></td>
	          <td><input type="text" name="Nationality" id="Nationality" value="<?php echo $nat; ?>"  /></td>
	          </tr>
	        <tr>
	          <td><font  size="-1">Title</font></td>
	          <td><select name="Title" id="Title"  value="<?php echo $tit; ?>" >
	            <option value="Mr">Mr</option>
	            <option value="Mrs">Mrs</option>
	            <option value="Ms">Ms</option>
	            </select></td>
	          <td><font  size="-1">Religion</font></td>
	          <td><input type="text" name="Religion" id="Religion" value="<?php echo $rel; ?>"  /></td>
	          </tr>
	        <tr>
	          <td><font  size="-1">Firstname </font></td>
	          <td><input type="text" name="Firstname" id="Firstname" value="<?php echo $fna; ?>"  /></td>
	          <td><font  size="-1">Permanent Address</font></td>
	          <td><input type="text" name="PermanentAddress" id="Permanent Address" value="<?php echo $padd; ?>"  /></td>
	          </tr>
	        <tr>
	          <td><br />
	            Lastname </td>
	          <td><input type="text" name="Lastname" id="Lastname" value="<?php echo $lna; ?>"  /></td>
	          <td><font  size="-1">Temporary Address</font></td>
	          <td><input type="text" name="TemporaryAddress" id="Temporary Address" value="<?php echo $tmp; ?>"  /></td>
	          </tr>
	        <tr>
	          <td><font  size="-1">NICno </font></td>
	          <td><input type="text" name="NICno" id="NICno" value="<?php echo $nic; ?>"  placeholder="897591740v" pattern="[0-9]{9}v" /></td>
	          <td><font  size="-1">Faculty</font></td>
	          <td><select name="Faculty" id="Faculty" value="<?php echo $fac; ?>" >
	            <option value="Science">Science</option>
	            <option value="Arts">Arts</option>
	            </select></td>
	          </tr>
	        <tr>
	          <td><font  size="-1">Gender</font></td>
	          <td><input type="radio" name="radio" id="Male" value="Male" value="<?php  echo $gen; ?>" />
	            Male
	            <label></label>
	            <input type="radio" name="radio" id="Female" value="Female" />
	            <label>Female</label></td>
	          <td><font  size="-1">CourseOfStudy</font></td>
	          <td><select name="CourseOfStudy" id="CourseOfStudy"  value="<?php echo $cou; ?>" >
	            <option value="Computerscience">Computerscience</option>
	            <option value="Bioscience">Bioscience</option>
	            </select></td>
	          </tr>
	        <tr>
	          <td><font  size="-1">Civilstatus</font></td>
	          <td><select name="Civilstatus" id="Civilstatus" value="<?php echo $civ; ?>" >
	            <option value="Single">Single</option>
	            <option value="Married">Married</option>
	            </select></td>
	          <td><font  size="-1">Academic year</font></td>
	          <td><select name="Academicyear" id="Academic year" value="<?php echo $aca; ?>" >
	             <option value='<?php  $name ?>'><?php  $name?></option>
				   <?php
				  $connect = mysql_connect("localhost", "root", "") or die ("Error , check your server connection.");
mysql_select_db("stms");

		 $result=mysql_query("SELECT * FROM new");
		
					while($row=mysql_fetch_array($result))
					{
		echo "<option value='".$row['Academicyear']."'>".$row['Academicyear']."</option>";
		
					}
				
					?>
	                </select>
				<a href="data/year.php?a=aca" >next</a></p></td>
				
	          </tr>
	        <tr>
	          <td><font  size="-1">DOB</font></td>
	          <td><input type="text" name="DOB" id="DOB"  placeholder="yyyy-mm-dd" value="<?php echo $dob; ?>"  pattern="[0-9]{4}-[0-9]{2}-[0-9]{2}"  /></td>
	          <td><font  size="-1">District</font></td>
	          <td><select name="District" id="District" value="<?php echo $dis; ?>" >
	            <option value="Jaffna">Jaffna</option>
	            <option value="Colombo">Colombo</option>
	            </select></td>
	          </tr>
          </table></td>
	      <td width="278" height="25"><label for="Search">Search</label>
            <input type="text" name="Searcher" id="Search"  />
            <input type="submit" name="Search2" id="Search3" value="Search" /></td>
        </tr>
	    <tr>
	      <td><?php
		  if(isset($_GET['err2'])) 
		{
		 $err2 = $_GET['err2'];
		 $result=mysql_query("SELECT * FROM basicdetails WHERE Regno='$err2'");
		  require_once 'data/databaseconnection.php';
		echo  "<div class=scrollbar >";


			echo "<table border=1>";
			echo "<tr>";
			echo "<th>Regno</th>";
			echo "<th>Title</th>";
			echo "<th>Firstname</th>";
			echo "<th>Lastname</th>";
			echo "<th>NICno</th>";
			echo "<th>Gender</th>";
			echo "<th>Civilstatus</th>";
			echo "<th>DOB</th>";
			echo "<th>Nationality	</th>";
			echo "<th>Religion</th>";
			echo "<th>Permanentaddress</th>";
			echo "<th>Temporaryaddress</th>";
			echo "<th>Faculty</th>";
			echo "<th>CourseOfStudy	</th>";
			echo "<th>AcademicYear</th>";
			echo "<th>District	</th>";
			
			
			//$result=mysql_query("SELECT * FROM basicdetails");
			while($row=mysql_fetch_array($result))
			{
				echo "<tr><td>".$row['Regno'];
				echo "<td>".$row['Title'];
				echo "<td>".$row['Firstname'];
				echo "<td>".$row['Lastname'];
				echo "<td>".$row['NICno'];
				echo "<td>".$row['Gender'];
				echo "<td>".$row['Civilstatus'];
				echo "<td>".$row['DOB'];
				echo "<td>".$row['Nationality'];
				echo "<td>".$row['Religion'];
				echo "<td>".$row['Permanentaddress'];
				echo "<td>".$row['Temporaryaddress'];
				echo "<td>".$row['Faculty'];
				echo "<td>".$row['CourseOfStudy'];
				echo "<td>".$row['AcademicYear'];
				echo "<td>".$row['District'];
				
			}
			echo "</table>";
		}
		else
		{
			  require_once 'data/databaseconnection.php';
		echo  "<div class=scrollbar  scrollbar-track-color: #FF00FF>";
			echo "<table border=1>";
			echo "<tr>";
			echo "<th>Regno</th>";
			echo "<th>Title</th>";
			echo "<th>Firstname</th>";
			echo "<th>Lastname</th>";
			echo "<th>NICno</th>";
			echo "<th>Gender</th>";
			echo "<th>Civilstatus</th>";
			echo "<th>DOB</th>";
			echo "<th>Nationality	</th>";
			echo "<th>Religion</th>";
			echo "<th>Permanentaddress</th>";
			echo "<th>Temporaryaddress</th>";
			echo "<th>Faculty</th>";
			echo "<th>CourseOfStudy	</th>";
			echo "<th>AcademicYear</th>";
			echo "<th>District	</th>";
			
			
			$result=mysql_query("SELECT * FROM basicdetails");
			while($row=mysql_fetch_array($result))
			{
				echo "<tr><td>".$row['Regno'];
				echo "<td>".$row['Title'];
				echo "<td>".$row['Firstname'];
				echo "<td>".$row['Lastname'];
				echo "<td>".$row['NICno'];
				echo "<td>".$row['Gender'];
				echo "<td>".$row['Civilstatus'];
				echo "<td>".$row['DOB'];
				echo "<td>".$row['Nationality'];
				echo "<td>".$row['Religion'];
				echo "<td>".$row['Permanentaddress'];
				echo "<td>".$row['Temporaryaddress'];
				echo "<td>".$row['Faculty'];
				echo "<td>".$row['CourseOfStudy'];
				echo "<td>".$row['AcademicYear'];
				echo "<td>".$row['District'];
				
			}
			echo "</table>";
		}
			echo "</div>";
		  ?></td>
        </tr>
	    </table>
	  <p>&nbsp;</P>
       
          <p align="center">
            <label for="Regno">
              <div align="left">
              <p>&nbsp;</p>
              <table width="377" border="0">
                <tr>
                  <td width="59"><div align="center">
                    <input type="submit" name="ADD" id="ADD" value="Add" />
                  </div></td>
                  <td width="79"><div align="center">
                    <input type="submit" name="UPDATE" id="UPDATE" value="Update" />
                  </div></td>
                  <td width="75"><input type="submit" name="DELETE" id="DELETE" value="Delete" /></td>
                  	              <td width="146"><input type="submit" name="Search" id="Search2" value="Search" /></td>
			    </tr>
              </table>
<div align="left"></div>
        </form>
    </div>
      <div id="footer">
        <ul>
          <li><a href="HometoAdmin.php">Home</a> | </li>
          <li><a href="Aboutus.php">About Us</a> | </li>
          <li></li>
          <li><a href="http://studentmanagements.blogspot.com/">Contact</a></li>
        </ul>
        <p>copyright &copy;STMS Group03</p>
      </div>
    </div>
  </div>
</body>
</html>
